package com.ruoyi.medicine.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.medicine.mapper.MedicineCategoryMapper;
import com.ruoyi.medicine.domain.MedicineCategory;
import com.ruoyi.medicine.service.IMedicineCategoryService;

/**
 * 药品分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class MedicineCategoryServiceImpl implements IMedicineCategoryService 
{
    @Autowired
    private MedicineCategoryMapper medicineCategoryMapper;

    /**
     * 查询药品分类
     * 
     * @param id 药品分类主键
     * @return 药品分类
     */
    @Override
    public MedicineCategory selectMedicineCategoryById(Long id)
    {
        return medicineCategoryMapper.selectMedicineCategoryById(id);
    }

    /**
     * 查询药品分类列表
     * 
     * @param medicineCategory 药品分类
     * @return 药品分类
     */
    @Override
    public List<MedicineCategory> selectMedicineCategoryList(MedicineCategory medicineCategory)
    {
        return medicineCategoryMapper.selectMedicineCategoryList(medicineCategory);
    }

    /**
     * 新增药品分类
     * 
     * @param medicineCategory 药品分类
     * @return 结果
     */
    @Override
    public int insertMedicineCategory(MedicineCategory medicineCategory)
    {
        medicineCategory.setCreateTime(DateUtils.getNowDate());
        return medicineCategoryMapper.insertMedicineCategory(medicineCategory);
    }

    /**
     * 修改药品分类
     * 
     * @param medicineCategory 药品分类
     * @return 结果
     */
    @Override
    public int updateMedicineCategory(MedicineCategory medicineCategory)
    {
        medicineCategory.setUpdateTime(DateUtils.getNowDate());
        return medicineCategoryMapper.updateMedicineCategory(medicineCategory);
    }

    /**
     * 批量删除药品分类
     * 
     * @param ids 需要删除的药品分类主键
     * @return 结果
     */
    @Override
    public int deleteMedicineCategoryByIds(Long[] ids)
    {
        return medicineCategoryMapper.deleteMedicineCategoryByIds(ids);
    }

    /**
     * 删除药品分类信息
     * 
     * @param id 药品分类主键
     * @return 结果
     */
    @Override
    public int deleteMedicineCategoryById(Long id)
    {
        return medicineCategoryMapper.deleteMedicineCategoryById(id);
    }
}
